\(\int \frac {1+x^2}{1-3 x^2+x^4} \, dx\) [77]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 18, antiderivative size = 65 \[ \int \frac {1+x^2}{1-3 x^2+x^4} \, dx=\frac {1}{2} \log \left (1-\sqrt {5}-2 x\right )+\frac {1}{2} \log \left (1+\sqrt {5}-2 x\right )-\frac {1}{2} \log \left (1-\sqrt {5}+2 x\right )-\frac {1}{2} \log \left (1+\sqrt {5}+2 x\right ) \]

[Out]

1/2*ln(1-2*x-5^(1/2))-1/2*ln(1+2*x-5^(1/2))+1/2*ln(1-2*x+5^(1/2))-1/2*ln(1+2*x+5^(1/2))

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 65, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {1175, 630, 31} \[ \int \frac {1+x^2}{1-3 x^2+x^4} \, dx=\frac {1}{2} \log \left (-2 x-\sqrt {5}+1\right )+\frac {1}{2} \log \left (-2 x+\sqrt {5}+1\right )-\frac {1}{2} \log \left (2 x-\sqrt {5}+1\right )-\frac {1}{2} \log \left (2 x+\sqrt {5}+1\right ) \]

[In]

Int[(1 + x^2)/(1 - 3*x^2 + x^4),x]

[Out]

Log[1 - Sqrt[5] - 2*x]/2 + Log[1 + Sqrt[5] - 2*x]/2 - Log[1 - Sqrt[5] + 2*x]/2 - Log[1 + Sqrt[5] + 2*x]/2

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 630

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Dist[c/q, Int[1/Simp
[b/2 - q/2 + c*x, x], x], x] - Dist[c/q, Int[1/Simp[b/2 + q/2 + c*x, x], x], x]] /; FreeQ[{a, b, c}, x] && NeQ
[b^2 - 4*a*c, 0] && PosQ[b^2 - 4*a*c] && PerfectSquareQ[b^2 - 4*a*c]

Rule 1175

Int[((d_) + (e_.)*(x_)^2)/((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4), x_Symbol] :> With[{q = Rt[2*(d/e) - b/c, 2]},
Dist[e/(2*c), Int[1/Simp[d/e + q*x + x^2, x], x], x] + Dist[e/(2*c), Int[1/Simp[d/e - q*x + x^2, x], x], x]] /
; FreeQ[{a, b, c, d, e}, x] && NeQ[b^2 - 4*a*c, 0] && EqQ[c*d^2 - a*e^2, 0] && (GtQ[2*(d/e) - b/c, 0] || ( !Lt
Q[2*(d/e) - b/c, 0] && EqQ[d - e*Rt[a/c, 2], 0]))

Rubi steps \begin{align*} \text {integral}& = \frac {1}{2} \int \frac {1}{1-\sqrt {5} x+x^2} \, dx+\frac {1}{2} \int \frac {1}{1+\sqrt {5} x+x^2} \, dx \\ & = \frac {1}{2} \int \frac {1}{\frac {1}{2} \left (-1-\sqrt {5}\right )+x} \, dx-\frac {1}{2} \int \frac {1}{\frac {1}{2} \left (1-\sqrt {5}\right )+x} \, dx+\frac {1}{2} \int \frac {1}{\frac {1}{2} \left (-1+\sqrt {5}\right )+x} \, dx-\frac {1}{2} \int \frac {1}{\frac {1}{2} \left (1+\sqrt {5}\right )+x} \, dx \\ & = \frac {1}{2} \log \left (1-\sqrt {5}-2 x\right )+\frac {1}{2} \log \left (1+\sqrt {5}-2 x\right )-\frac {1}{2} \log \left (1-\sqrt {5}+2 x\right )-\frac {1}{2} \log \left (1+\sqrt {5}+2 x\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 29, normalized size of antiderivative = 0.45 \[ \int \frac {1+x^2}{1-3 x^2+x^4} \, dx=-\frac {1}{2} \log \left (1-x-x^2\right )+\frac {1}{2} \log \left (1+x-x^2\right ) \]

[In]

Integrate[(1 + x^2)/(1 - 3*x^2 + x^4),x]

[Out]

-1/2*Log[1 - x - x^2] + Log[1 + x - x^2]/2

Maple [A] (verified)

Time = 0.04 (sec) , antiderivative size = 22, normalized size of antiderivative = 0.34

method result size
default \(-\frac {\ln \left (x^{2}+x -1\right )}{2}+\frac {\ln \left (x^{2}-x -1\right )}{2}\) \(22\)
norman \(-\frac {\ln \left (x^{2}+x -1\right )}{2}+\frac {\ln \left (x^{2}-x -1\right )}{2}\) \(22\)
risch \(-\frac {\ln \left (x^{2}+x -1\right )}{2}+\frac {\ln \left (x^{2}-x -1\right )}{2}\) \(22\)
parallelrisch \(-\frac {\ln \left (x^{2}+x -1\right )}{2}+\frac {\ln \left (x^{2}-x -1\right )}{2}\) \(22\)

[In]

int((x^2+1)/(x^4-3*x^2+1),x,method=_RETURNVERBOSE)

[Out]

-1/2*ln(x^2+x-1)+1/2*ln(x^2-x-1)

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 21, normalized size of antiderivative = 0.32 \[ \int \frac {1+x^2}{1-3 x^2+x^4} \, dx=-\frac {1}{2} \, \log \left (x^{2} + x - 1\right ) + \frac {1}{2} \, \log \left (x^{2} - x - 1\right ) \]

[In]

integrate((x^2+1)/(x^4-3*x^2+1),x, algorithm="fricas")

[Out]

-1/2*log(x^2 + x - 1) + 1/2*log(x^2 - x - 1)

Sympy [A] (verification not implemented)

Time = 0.05 (sec) , antiderivative size = 19, normalized size of antiderivative = 0.29 \[ \int \frac {1+x^2}{1-3 x^2+x^4} \, dx=\frac {\log {\left (x^{2} - x - 1 \right )}}{2} - \frac {\log {\left (x^{2} + x - 1 \right )}}{2} \]

[In]

integrate((x**2+1)/(x**4-3*x**2+1),x)

[Out]

log(x**2 - x - 1)/2 - log(x**2 + x - 1)/2

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 21, normalized size of antiderivative = 0.32 \[ \int \frac {1+x^2}{1-3 x^2+x^4} \, dx=-\frac {1}{2} \, \log \left (x^{2} + x - 1\right ) + \frac {1}{2} \, \log \left (x^{2} - x - 1\right ) \]

[In]

integrate((x^2+1)/(x^4-3*x^2+1),x, algorithm="maxima")

[Out]

-1/2*log(x^2 + x - 1) + 1/2*log(x^2 - x - 1)

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 43, normalized size of antiderivative = 0.66 \[ \int \frac {1+x^2}{1-3 x^2+x^4} \, dx=-\frac {1}{4} \, \log \left ({\left | x + \frac {1}{x - \frac {1}{x}} - \frac {1}{x} + 2 \right |}\right ) + \frac {1}{4} \, \log \left ({\left | x + \frac {1}{x - \frac {1}{x}} - \frac {1}{x} - 2 \right |}\right ) \]

[In]

integrate((x^2+1)/(x^4-3*x^2+1),x, algorithm="giac")

[Out]

-1/4*log(abs(x + 1/(x - 1/x) - 1/x + 2)) + 1/4*log(abs(x + 1/(x - 1/x) - 1/x - 2))

Mupad [B] (verification not implemented)

Time = 0.27 (sec) , antiderivative size = 12, normalized size of antiderivative = 0.18 \[ \int \frac {1+x^2}{1-3 x^2+x^4} \, dx=-\mathrm {atanh}\left (\frac {x}{x^2-1}\right ) \]

[In]

int((x^2 + 1)/(x^4 - 3*x^2 + 1),x)

[Out]

-atanh(x/(x^2 - 1))